Force update of Attribute DXL?

I have a module that uses Attribute DXL to put its value into another (non-DXL) attribute.

I want to write a DXL script that opens each specified module in exclusive edit, scrolls through each object, then saves and close the module. In other words, I want to force Attribute DXL to update.

I have a script that does something like this:

//code begin

Object o
Module m = some_module

for o in m do {
current = o
}
//code end

Unfortunately this doesn't work. Does anyone know a way around this issue? I feel like I'm missing something obvious.

Thanks!
Kevin
kbmurphy - Thu Dec 03 19:52:27 EST 2009

Re: Force update of Attribute DXL?
SystemAdmin - Fri Dec 04 00:59:55 EST 2009

First set the attribute DXL to have a null value and then query the value. Or as DXL Help describes it "The calculation only takes place the first time the attribute is accessed, or if it is later cleared to null and is subsequently accessed again. This means the DXL code is not executed when the containing module is opened, but when some event occurs that causes the attribute to be accessed."

For you code (presuming the DXL attribute is of type string or text)
 

Object o
Module m = some_module
 
for o in m do {
current = o
o.DXL_Attribute = (string null)
string tempStr = o.DXL_Attribute ""
}

Re: Force update of Attribute DXL?
doors36677 - Fri Dec 04 08:15:11 EST 2009

SystemAdmin - Fri Dec 04 00:59:55 EST 2009

First set the attribute DXL to have a null value and then query the value. Or as DXL Help describes it "The calculation only takes place the first time the attribute is accessed, or if it is later cleared to null and is subsequently accessed again. This means the DXL code is not executed when the containing module is opened, but when some event occurs that causes the attribute to be accessed."

For you code (presuming the DXL attribute is of type string or text)
 

Object o
Module m = some_module
 
for o in m do {
current = o
o.DXL_Attribute = (string null)
string tempStr = o.DXL_Attribute ""
}

Pekka

The method you posted is a partial solution that may work in your instance.

Full solution is given by IBM in wipeattr.dxl.

Re: Force update of Attribute DXL?
SystemAdmin - Fri Dec 04 08:17:49 EST 2009

doors36677 - Fri Dec 04 08:15:11 EST 2009
Pekka

The method you posted is a partial solution that may work in your instance.

Full solution is given by IBM in wipeattr.dxl.

Hopefully it works also for Kevin. Did not remember the wipeattr, thanks - this file is an example how to solve the refresh issue for all DXL attributes in module.

Re: Force update of Attribute DXL?
SystemAdmin - Fri Dec 04 09:24:34 EST 2009

doors36677 - Fri Dec 04 08:15:11 EST 2009
Pekka

The method you posted is a partial solution that may work in your instance.

Full solution is given by IBM in wipeattr.dxl.

Please note the comment in wipeattr.dxl (with DOORS version 8.3):
/*
This function forces a recalculation of any attributes which
are driven by attribute DXL on all displayed objects in the
module.

*/

That is, it only forces those attribute DXL to recalculate that are displayed in the current view.

Therefore, the second step proposed by Pekka is at least for the not displayed attribute DXL required to have them recalculated as well. Note also the related explanation in the DXL reference.

HTH
Markus

Re: Force update of Attribute DXL?
llandale - Mon Dec 07 16:47:25 EST 2009

AttrDXL is calculated the first time the value is used after opening the module, and whenever the value is set to null. All object valules are set to null by the Tools menu >Recalculate DXL Attr command.

All you need to do is access the value, you don't need to erase it. Accessing the object is only sufficient when the attrDXL is displayed in the view.

string  Value
Object  obj
Module mod = edit(MyModuleName, false)
for obj in entire mod do
{  Value = obj.NameAttrDXL
}
close(mod)


Keep in mind that a bug in v9.2.0.1 prevents DXL from modifying values of a deleted object, so your attrDXL code should check for that before setting the other attr.

 

 

  • Louie


Note: since attrDXL calculates when its set to null, your attrDXL code should <not> set the value null, otherwise recalculation thrashing occurs. I routinely set the value to a space instead of null.